package com.bz.common;

/**
 * Description: 分页工具类<br>
 */
public class PageUtil {

    public static long pageSize   = 20;
    public static long pageSize10 = 10;

    /**
     * Description: 构造分页参数<br>
     * Created date: 2020年5月3日
     * 
     * @param current
     *            当前页数
     * @param size
     *            页大小
     * @return 分页参数对象
     * @author L
     */
    public static <P> PageInfo<P> getPageInfo(Long current, long size) {
        if (null == current) {
            current = 1L;
        }
        return new PageInfo<>(current, size);
    }

    /**
     * 偏移量
     * 
     * @param current
     * @param size
     * @return
     */
    public static long offset(long current, long size) {
        return current <= 1L ? 0L : (current - 1L) * size;
    }

}
